<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path;
	request.setAttribute("path", basePath);
%>
<%@ page import="java.util.HashSet"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
<link href="<%=basePath%>/source/css/common.css">
<script src="<%=basePath%>/source/js/jquery-1.9.1.min.js"></script>
<script type="text/javascript"
	src="<%=basePath%>/source/js/angular.min.js"></script>
<script>
	
</script>
</head>
<body ng-app="app">
<%=basePath%>
	${path}
	<div>${sessionsize}</div>
	<h1>上传</h1>
	${redirect }
	<form name="userForm" action="<%=basePath%>/file/upload1.do" method="post"
		enctype="multipart/form-data">
		选择文件：<input type="file" name="filename"> <input type="submit"
			value="提交">
	</form>
	<form action="<%=basePath%>/chbox.do" method="get" id="chForm">
		<input type="checkbox" name="chbox" value="1"> <input
			type="checkbox" name="chbox" value="2"> <input
			type="checkbox" name="chbox" value="3"> <input type="hidden"
			name="chbox">
	</form>
	<form action="<%=basePath%>/aaa.do" method="post">
		<input type="text" name="str"/>
		<input type="text" name="i"/>
		<input type="submit" value="validata"/>
	</form>
	<button onclick="good()">button</button>
	<a href="<%=basePath%>/ajax.do">ajax</a>
	<a href="<%=basePath%>/cache.do">cache</a>
	<div ng-controller="demo">
		<div ng-click="getDemo()">getDemo</div>
		<div ng-click="postDemo()">postDemo</div>
		<div ng-click="postDemo2()">postDemo2</div>
		<div ng-click="putDemo()">putDemo</div>
		<div ng-click="deleteDemo()">deleteDemo</div>
	</div>
	<script>
		var app = angular.module('app', []);
		app.controller('demo', function($scope, $http) {
			$scope.getDemo = function() {
				 $http({
						url : "http://http://localhost:8080/cors/Login",
						method : 'GET',
						params : {
							good : 'good',
							better : 'better'
						},
						cache : true
					//true就是缓存http请求
					}).success(function(data) {
						console.log(data);
					});
				<%-- $http({
					url : "<%=basePath%>/getDemo.do",
					method : 'GET',
					params : {
						good : 'good',
						better : 'better'
					},
					cache : true
				//true就是缓存http请求
				}).success(function(data) {
					console.log(data);
				}); --%>
			}
			$scope.postDemo = function() {
				$http({
					url : "<%=basePath%>/postDemo.do",
					method : 'POST',
					data : {
						good : "good",
						better : "better"
					}
				}).success(function(data) {
					console.log(data);
				});
			}
			/* $scope.getDemo=function(){
				//这样加一个请求头
				$http.defaults.headers.common.Authorization = 'Basic YmVlcDpib29w';
				$http.get('/spring/getDemo.do')
				.success(function(data){
					console.log(data);
				});
			}
			$scope.postDemo=function(){
				$http.post('/spring/postDemo.do',{good:"good",better:"better"})
				.success(function(data){
					console.log(data);
				});
			}
			$scope.postDemo2=function(){
				$http.post('/spring/postDemo2.do',"good")
				.success(function(data){
					console.log(data);
				});
			}
			$scope.putDemo=function(){
				$http.put('/spring/putDemo.do',{better:"better"})
				.success(function(data){
					console.log(data);
				});
			}
			$scope.deleteDemo=function(){
				$http.delete('/spring/deleteDemo.do')
				.success(function(data){
					console.log(data);
				});
			} */

		});
	</script>
</body>
</html>
